import http from '@/apis/http'

import { aiLearnPad, examSystem, ACCOUNT_CENTER_SYSTEM } from '@/apis'

import {
  statisticsPath,
  trendPath,
  teacherRankPath,
  examSystemTokenPath
} from './path'

export const postExamSystemToken = async data => {
  const { token, user_id } = data
  return http.post(
    examSystem + examSystemTokenPath + `?token=${token}&user_id=${user_id}`,
    {
      headers: {
        'Content-Type': 'application/json'
      }
    }
  )
}

export const postStatistics = async data => {
  return http.post(aiLearnPad + statisticsPath, data, {
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export const postTrend = async data => {
  return http.post(aiLearnPad + trendPath, data, {
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export const getTeacherRank = async data => {
  return http.get(
    aiLearnPad + teacherRankPath + `?page=${data.page}&size=${data.size}`
  )
}

// 获取中台用户在爱学空间的token
export function getSmartRoomToken(params) {
  return http.get(
    `${ACCOUNT_CENTER_SYSTEM}/api/v2/person/teacher/user_ailearn_token`,
    { params }
  )
}
